/*河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
*/
package cn.javaxc.oa.action.system;
import java.io.*;
import java.util.*;
import java.sql.*;
import cn.javaxc.model.base.SQL;
import cn.javaxc.model.base.SQLList;
import cn.javaxc.model.base.SQLMap;
import cn.javaxc.model.base.SQLParam;
import cn.javaxc.model.page.BatisPage;
import cn.javaxc.mvcwork.controller.web.TreeBean;
import cn.javaxc.mvcwork.util.common.CommonUtil;
import cn.javaxc.mvcwork.util.common.MapListUtil;
import cn.javaxc.mvcwork.util.helper.FrameHelper;
import cn.javaxc.mvcwork.util.helper.TreeTableHelper;
import org.springframework.beans.factory.annotation.Autowired;
import cn.javaxc.system.action.base.BaseAction;
import cn.javaxc.oa.mapper.system.TimeInsertMapper;
public class TimeInsert extends BaseAction
{
    @Autowired(required=false)
	private TimeInsertMapper mapper;
    /**
    时间设置
    */
    
    public Map timeInsert() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> t_month=mapper.t_month(params);
        SQLMap t_month_emt=t_month.getExistfirst();
        result.put("t_month", t_month_emt);
        
        
        SQLList<SQLMap> s_week=mapper.s_week(params);
        result.put("s_week", s_week);
        
        
        SQLList<SQLMap> s_holid=mapper.s_holid(params);
        result.put("s_holid", s_holid);
        
        
        SQLList<SQLMap> s_worktime=mapper.s_worktime(params);
        result.put("s_worktime", s_worktime);
        
        
        SQLList<SQLMap> s_worktime_day=mapper.s_worktime_day(params);
        result.put("s_worktime_day", s_worktime_day);
        
        
        SQLList<SQLMap> s_year=mapper.s_year(params);
        s_year.setSelectNone("年");
        result.put("s_year", s_year);
        
        
        SQLList<SQLMap> s_month=mapper.s_month(params);
        s_month.setSelectNone("月");
        result.put("s_month", s_month);
        
        
        
        
        params.def("CMIDSEL1",SQL.getYear());
        Object CMIDSEL1 =mapper.CMIDSEL1(params);
        result.put("CMIDSEL1", CMIDSEL1);
        
        
        params.def("CMIDSEL2",SQL.getMonth());
        Object CMIDSEL2 =mapper.CMIDSEL2(params);
        result.put("CMIDSEL2", CMIDSEL2);
        
        
        SQLList<SQLMap> s_search=mapper.s_search(params);
        SQLMap s_search_emt=s_search.getExistfirst();
        result.put("s_search", s_search_emt);
        
        
        Object role_id =mapper.role_id(params);
        result.put("role_id", role_id);
        
        
        
        
        SQLList<SQLMap> s_calendar=mapper.s_calendar(params);
        result.put("s_calendar", s_calendar);
        
        
        result.put("s_calendar", MapListUtil.split(s_calendar,7));
        
        
        SQLList<SQLMap> s_im=mapper.s_im(params);
        SQLMap s_im_emt=s_im.getExistfirst();
        result.put("s_im", s_im_emt);
        
        return result;
    }
    /**
    星期设置
    */
    
    public Map weekModify() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        
        
        Object weekCount =mapper.weekCount(params);
        result.put("weekCount", weekCount);
        
        
        SQLList<SQLMap> l_worktime_week=mapper.l_worktime_week(params);
        result.put("l_worktime_week", l_worktime_week);
        
        return result;
    }
    /**
    修改时间应用范围
    */
    
    public Map timeApply() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> t_month=mapper.t_month(params);
        SQLMap t_month_emt=t_month.getExistfirst();
        result.put("t_month", t_month_emt);
        
        return result;
    }
    /**
    检查时间设置
    */
    
    public Map timeCheck() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_work=mapper.s_work(params);
        SQLMap s_work_emt=s_work.getExistfirst();
        result.put("s_work", s_work_emt);
        
        
        SQLList<SQLMap> infolist=new SQLList();
        result.put("infolist", infolist);
        
        
        result.put("work_time", getAfterWorkHour(
        s_work.getExistfirst().getTimestamp("month_betime"),s_work.getExistfirst().getTimestamp("month_entime")
        ,context.getParameter("CMIDcode"),context.getParameter("CMID7")
        ));
        
        return result;
    }
    /**
    工作时间
    */
    
    public Map worktimeManage() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_hour=mapper.s_hour(params);
        result.put("s_hour", s_hour);
        
        
        SQLList<SQLMap> s_minute=mapper.s_minute(params);
        result.put("s_minute", s_minute);
        
        
        SQLList<SQLMap> l_worktime=mapper.l_worktime(params);
        result.put("l_worktime", l_worktime);
        
        return result;
    }
    /**
    */
    
    public Map d_holid() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        mapper.d_holid(params);
        
        return result;
    }
    /**
    */
    
    public Map d_worktime() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        mapper.d_worktime(params);
        
        return result;
    }
    /**
    */
    
    public Map d_worktime_day() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        mapper.d_worktime_day(params);
        
        return result;
    }
    /**
    星期设置修改
    */
    
    public Map weekModifySubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        int weekInsert = mapper.weekInsert(params);
        result.put("weekInsert", weekInsert);
        
        
        for (SQLMap emt:hqlBean.getTableElements("")){
            params=new SQLParam(request,emt.getMap());
            mapper.weekModifySubmit(params);
        }
        
        
        
        
        
        
        
        return result;
    }
    /**
    修改时间应用范围修改
    */
    
    public Map timeApplySubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        Object t_count =
        mapper.t_count(params);
        result.put("t_count", t_count);
        
        
        mapper.timeApplySubmit(params);
        
        return result;
    }
    /**
    工作时间修改
    */
    
    public Map worktimeManageSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        result.put("v_start_hour", SQL.setTime(null,getParameter("startHour"),getParameter("startMinute"),null));
        
        
        result.put("v_end_hour", SQL.setTime(null,getParameter("endHour"),getParameter("endMinute"),null));
        
        
        params.def("startHour",-1);
        params.def("endHour",-1);
        int id = mapper.id(params);
        result.put("id", id);
        
        return result;
    }
}